<template>
    <div>
        
        <h1>会员等级增加</h1>
        <table class="table table-bordered">
            <tbody>
                <tr>
                    <td align="right">会员等级名称</td>
                    <td><input type="text" v-model="info.Name"></td>
                </tr>
                <tr>
                    <td align="right">累计消费金额</td>
                    <td><input type="text" v-model="info.Price"></td>
                </tr>
                <tr>
                    <td align="right"></td>
                    <td><input type='button' value="添加" @click="ok"></td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import { ref, reactive } from 'vue'
import axios from 'axios';
import { useRouter } from 'vue-router';
const rouder = useRouter();
let info: any = reactive({
    Name: '',
    Price: ''
})
const ok = () => {
    axios({
        url: '/api/Hy/Addd',
        method: 'post',
        data: info
    })
        .then((res) => {
            console.log(res);
            if (res.data == -1) {
                alert('会员名称重复');
                return;
            }
            if (res.data > 0) {
                alert('添加成功');
                return;
            }
            else {
                alert('添加失败');
                return;
            }
        })
        .catch((err) => {
            console.log(err);

        })
}




</script>

<style scoped></style>